package com.woniuxy.bookmallmanagersrever.service;

import com.woniuxy.bookmallmanagersrever.mapper.TBookMapper;
import com.woniuxy.bookmallmanagersrever.repository.EsRepository;
import com.woniuxy.bookmallmanagersrever.vo.EsBook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EsService {
    @Autowired
    EsRepository esRepository ;

    @Autowired
    TBookMapper bookMapper ;

    /**
     * 初始化es索引库
     */
    public void initBookmallIndex(){
        List<EsBook> list = bookMapper.selectAllEsBook();
        //把数据导入到索引库
        esRepository.saveAll(list);
    }
}
